<?php
class MyClient
{
	public function getBrowse()
	{
		$browser = $_SERVER['HTTP_USER_AGENT'];
		if(strpos(strtolower($browser),"netcaptor"))
		$exp = "NetCaptor";
		elseif(strpos(strtolower($browser),"firefox")){
			preg_match("/Firefox\/([^;)]+)+/i", $sys, $b);
			$exp = "Mozilla Firefox ".$b[1];
		}elseif(strpos(strtolower($browser),"maxthon")){
			preg_match("/MAXTHON\s+([^;)]+)+/i", $sys, $b);
			preg_match("/MSIE\s+([^;)]+)+/i", $sys, $ie);
			$exp = $b[0]." (IE".$ie[1].")";
		}elseif(strpos(strtolower($browser),"msie")){
			preg_match("/MSIE\s+([^;)]+)+/i", $sys, $ie);
			$exp = "Internet Explorer ".$ie[1];
		}elseif(strpos(strtolower($browser),"netscape"))
		$exp = "Netscape";
		elseif(strpos(strtolower($browser),"opera"))
		$exp = "Opera";
		else
		$exp = "未知浏览器";
			
		return $exp;
			
	}

	function getUseOs(){
		$sys = $_SERVER['HTTP_USER_AGENT'];
		if(stripos($sys, "NT 6.1"))
		$os = "Windows 7";
		elseif(stripos($sys, "NT 6.0"))
		$os = "Windows Vista";
		elseif(stripos($sys, "NT 5.1"))
		$os = "Windows XP";
		elseif(stripos($sys, "NT 5.2"))
		$os = "Windows Server 2003";
		elseif(stripos($sys, "NT 5"))
		$os = "Windows 2000";
		elseif(stripos($sys, "NT 4.9"))
		$os = "Windows ME";
		elseif(stripos($sys, "NT 4"))
		$os = "Windows NT 4.0";
		elseif(stripos($sys, "98"))
		$os = "Windows 98";
		elseif(stripos($sys, "95"))
		$os = "Windows 95";
		elseif(stripos($sys, "Mac"))
		$os = "Mac";
		elseif(stripos($sys, "Linux"))
		$os = "Linux";
		elseif(stripos($sys, "Unix"))
		$os = "Unix";
		elseif(stripos($sys, "FreeBSD"))
		$os = "FreeBSD";
		elseif(stripos($sys, "SunOS"))
		$os = "SunOS";
		elseif(stripos($sys, "BeOS"))
		$os = "BeOS";
		elseif(stripos($sys, "OS/2"))
		$os = "OS/2";
		elseif(stripos($sys, "PC"))
		$os = "Macintosh";
		elseif(stripos($sys, "AIX"))
		$os = "AIX";
		else
		$os = "未知操作系统";
		 
		return $os;
	}


	public function getOS ()
	{
		$agent = $_SERVER['HTTP_USER_AGENT'];
		$os = false;
		if (eregi('win', $agent) && strpos($agent, '95')){
			$os = 'Windows 95';
		}
		else if (eregi('win 9x', $agent) && strpos($agent, '4.90')){
			$os = 'Windows ME';
		}
		else if (eregi('win', $agent) && ereg('98', $agent)){
			$os = 'Windows 98';
		}
		else if (eregi('win', $agent) && eregi('nt 5.1', $agent)){
			$os = 'Windows XP';
		}
		else if (eregi('win', $agent) && eregi('nt 5.2', $agent)){
			$os = 'Windows 2003';
		}
		else if (eregi('win', $agent) && eregi('nt 5', $agent)){
			$os = 'Windows 2000';
		}
		else if (eregi('win', $agent) && eregi('nt', $agent)){
			$os = 'Windows NT';
		}
		else if (eregi('win', $agent) && ereg('32', $agent)){
			$os = 'Windows 32';
		}
		else if (eregi('linux', $agent)){
			$os = 'Linux';
		}
		else if (eregi('unix', $agent)){
			$os = 'Unix';
		}
		else if (eregi('sun', $agent) && eregi('os', $agent)){
			$os = 'SunOS';
		}
		else if (eregi('ibm', $agent) && eregi('os', $agent)){
			$os = 'IBM OS/2';
		}
		else if (eregi('Mac', $agent) && eregi('PC', $agent)){
			$os = 'Macintosh';
		}
		else if (eregi('PowerPC', $agent)){
			$os = 'PowerPC';
		}
		else if (eregi('AIX', $agent)){
			$os = 'AIX';
		}
		else if (eregi('HPUX', $agent)){
			$os = 'HPUX';
		}
		else if (eregi('NetBSD', $agent)){
			$os = 'NetBSD';
		}
		else if (eregi('BSD', $agent)){
			$os = 'BSD';
		}
		else if (ereg('OSF1', $agent)){
			$os = 'OSF1';
		}
		else if (ereg('IRIX', $agent)){
			$os = 'IRIX';
		}
		else if (eregi('FreeBSD', $agent)){
			$os = 'FreeBSD';
		}
		else if (eregi('teleport', $agent)){
			$os = 'teleport';
		}
		else if (eregi('flashget', $agent)){
			$os = 'flashget';
		}
		else if (eregi('webzip', $agent)){
			$os = 'webzip';
		}
		else if (eregi('offline', $agent)){
			$os = 'offline';
		}
		else {
			$os = 'Unknown';
		}
		return $os;
	}

}

?>